<?php

/**
 * 会员首页
 */

namespace app\member\common;

class IndexCommon extends \app\member\common\MemberCommon {

    protected function index() {
        $this->setMeta('会员中心');
        $this->pageInfo['name'] = '会员中心';


        if ($this->mobile) {

            $hookList = hook('service', 'html', 'MemberIndexMobile', [$this->userInfo]);
            $data = [];
            foreach ((array)$hookList as $value) {
                $data = array_merge_recursive((array)$data, (array)$value);
            }
            $data = array_sort($data, 'sort');
            $hookHtml = '';
            foreach ($data as $app => $vo) {
                if (!empty($vo)) {
                    $hookHtml .= $vo['html'];
                }
            }
            $this->assign('hookHtml', $hookHtml);


        } else {
            $hookList = hook('service', 'html', 'MemberIndexBody', [$this->userInfo]);

            $data = [];
            foreach ((array)$hookList as $value) {
                $data = array_merge_recursive((array)$data, (array)$value);
            }
            $data = array_sort($data, 'sort');
            $hookHtml = '';
            foreach ($data as $app => $vo) {
                if (!empty($vo)) {
                    $hookHtml .= $vo['html'];
                }
            }

            $hookSideList = hook('service', 'html', 'MemberIndexSide', [$this->userInfo]);
            $data = [];
            foreach ((array)$hookSideList as $value) {
                $data = array_merge_recursive((array)$data, (array)$value);
            }
            $data = array_sort($data, 'sort');
            $hookSideHtml = '';
            foreach ($data as $app => $vo) {
                if (!empty($vo)) {
                    $hookSideHtml .= $vo['html'];
                }
            }
            $this->assign('bodyHookHtml', $hookHtml);
            $this->assign('sideHookHtml', $hookSideHtml);
        }

        $this->memberDisplay();
    }


}